package cn.com.lms.business.examRewrite.persistence.entity;

import com.bnzj.core.persistence.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;

@Getter
@Setter
@Entity
@Table(name = "bnz_exam_question_category")
public class QuestionCategoryReWrite extends BaseEntity {


    @Schema(description = "上级分类")
    @Column(name = "parent_id")
    private Long parentId;

    @Schema(description = "分类名称")
    @Column(name = "category_name")
    private String categoryName;


    @Schema(description = "是否删除  0-未删除 1-已删除")
    @Column(name = "is_delete")
    private Boolean isDelete;


    @Transient
    private List<QuestionCategoryReWrite> children = new ArrayList<QuestionCategoryReWrite>();

    @Transient
    private QuestionCategoryReWrite parent;

    private static final QuestionCategoryReWrite root = new QuestionCategoryReWrite();

    static {
        root.setId(0L);
        root.setCategoryName("根分类");
    }

    public static QuestionCategoryReWrite getRoot() {
        return root;
    }
}
